import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import { User } from '../../model/user-model';


@Component({
  selector: 'app-login',
  templateUrl: './login.component.html',
  styleUrls: ['./login.component.css']
})
export class LoginComponent implements OnInit {
  isLogin: any;
  constructor(private _router: Router) { }
  user = { "username": null, "password": null };

  ngOnInit() {

  }


  login(): void {
    if (['mzlocker', 'admin'].indexOf(this.user.username) >= 0 && this.user.password == 'mzlocker001') {
      localStorage.setItem('isLogin', 'true');
      localStorage.setItem('username',this.user.username);
      this._router.navigateByUrl('/page');
    }
    else{
      alert('请输入正确账号密码');
    }

  }

}
